require('./bootstrap');

import Alpine from 'alpinejs';

window.Alpine = Alpine;

window.SearchUserForm = function () {
    return {
        formData: {
            user_full_name: "",
        },
        submitForm() {
            fetch('/search/user/' + this.formData.user_full_name, {
                method: "GET",    
            })
                .then(response => response.json())
                .then(json_data => {
                    Alpine.store('getUsers').updateItems(json_data.data);
                    this.formData.user_full_name = "";
                })
            ;
        }
    };
}

Alpine.start();
